<!DOCTYPE HTML>
<html>
<HEAD>
<meta charset="UTF-8">
<script type="text/javascript" src="js/jquery-1.3.2.js"></script> 
<script type="text/javascript" src="js/jquery.date_input.js"></script> 
<link rel="stylesheet" href="js/date_input.css" type="text/css">

<script>
  //日期插件
jQuery.extend(DateInput.DEFAULT_OPTS, { 
month_names: ["一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"], 
short_month_names: ["一", "二", "三", "四", "五", "六", "七", "八", "九", "十", "十一", "十二"], 
short_day_names: ["一", "二", "三", "四", "五", "六", "日"],
 dateToString: function(date) {
    var month = (date.getMonth() + 1).toString();
    var dom = date.getDate().toString();
    if (month.length == 1) month = "0" + month;
    if (dom.length == 1) dom = "0" + dom;
    return date.getFullYear() + "-" + month + "-" + dom;
  }

}); 



$(function() { 
$(".biuuu1").date_input(); 
$(".biuuu2").date_input(); 
}); 
</script>


<TITLE>刮刮卡管理</TITLE>
</HEAD>
<body>
    <b>刮刮卡管理</b>
<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

//进行连接数据库操作
include_once('../DB.php');
$DB =  new DB();
  
//保存用户输入的信息
if(isset($_POST['submit'])){
    
    $dataArray = array('guaguaka_key'=>$_POST['guaguaka_key'],'guaguaka_name'=>$_POST['guaguaka_name'],'guaguaka_info'=>$_POST['guaguaka_info'],
    'guaguaka_status'=>$_POST['guaguaka_status'],'addTime'=>strtotime($_POST['addTime']),'endTime'=> strtotime($_POST['endTime']),
        'reply_status'=>$_POST['reply_status'],'first_name'=>$_POST['first_name'],'first_number'=>$_POST['first_number']
            ,'second_name'=>$_POST['second_name'],'second_number'=>$_POST['second_number'],'third_name'=>$_POST['third_name'],
        'third_number'=>$_POST['third_number']);
    
    //prize 奖品数据
   // $prizeArray = array();
    
    //获取操作信息,如果是进行了更新操作
    if($_GET["action"]){
    $action=$_GET["action"];
        //获取ID号
     $id=intval($_GET["id"]);
    $bool = $DB->update("guaguaka",$dataArray,"id ={$id} "); 
    if($bool){
         echo "<script>alert('数据更新操作成功！');location='guaguaka_list.php';</Script>";
        }
    }
    //说明不是更新操作，是增加操作
    else{
 
     $bool = $DB->insert("guaguaka",$dataArray); 
     if($bool){
         echo "<script>alert('数据添加操作成功！');location='guaguaka_list.php';</Script>";
         }
    }

}
?>
    <b>添加大转盘活动</b>
    <form action="" method="post">
       关键词:<input type="text" name="zhuanpan_key" ></br>
       活动名称：<input type="text" name="name" ></br>
       兑奖信息：<input type="text" name="info" ></br>
       活动状态：<input type="text" name="zhuanpan_status" ></br>
       添加时间：<input type="text" class="biuuu1" name="addTime"/> </br>
       回复结束时间：<input type="text" class="biuuu2" name="endTime"/> </br>
       回复状态：<input type="text" name="reply_status" ></br>
       
       一等奖奖品名称<input ty  pe="text" name="first_name" ></br>
       一等奖奖品数量<input type="text" name="first_nummber" ></br>
       二等奖奖品名称<input type="text" name="second_name" ></br>
       二等奖奖品数量<input type="text" name="second_number" ></br>
       三等奖奖品名称<input type="text" name="third_name" ></br>
       三等奖奖品数量<input type="text" name="third_number" ></br>
         
       <input type="submit" name="submit" value="提交">
       
   </form>
    
</body>
</html>
                        